<template>
  <div class="electricity-container">
    <h2 class="title">用户参数(长期规划)</h2>
        <div class="center-input">
       <span class="input-label" style="width: 120px; text-align: right; margin-right: 8px;">加载数据参数N：</span>
         <el-input-number
          v-model="num"
          :min="6"
          :max="30"
          style="width: 80px; flex: 6;"
        ></el-input-number>
    </div>
    <input
              type="file"
              ref="fileInput"
              accept=".txt"
              @change="handleFileChange"
              style="display: none;"
            />
    <el-dialog v-model="dialogVisible" title="文件内容" width="80%">
      <pre>{{ fileContent }}</pre>
    </el-dialog>
    <div class="form-section">
     <el-dialog v-model="chartDialogVisible1" title="电力需求日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick1"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>

    </el-dialog>

      <div class="input-group">
        <label class="input-label">电力需求</label>
        <div class="input-controls">
           <button @click="showChart1" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile1" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput1"
                  @change="onFileChange1"
                  entityType="DianXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(131497-394296)
        </div>
      </div>


       <el-dialog v-model="chartDialogVisible2" title="电转生物质能需求日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick2"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">电转生物质能需求</label>
        <div class="input-controls">
          <button @click="showChart2" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile2" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput2"
                  @change="onFileChange2"
                  entityType="DianXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(394397-657096)
        </div>
      </div>


      <el-dialog v-model="chartDialogVisible3" title="用于交通的电能需求日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick3"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
            <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">用于交通的电能需求</label>
        <div class="input-controls">
           <button @click="showChart3" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile3" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput3"
                  @change="onFileChange3"
                  entityType="DianXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(657097-919896)
        </div>
      </div>


      <el-dialog v-model="chartDialogVisible4" title="热需求日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick4"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">热需求</label>
        <div class="input-controls">
           <button @click="showChart4" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile4" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput4"
                  @change="onFileChange4"
                  entityType="ReXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(943897-306696)
        </div>
      </div>



      <el-dialog v-model="chartDialogVisible5" title="冷需求日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick5"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
            <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">冷需求</label>
        <div class="input-controls">

           <button @click="showChart5" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile5" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput5"
                  @change="onFileChange5"
                  entityType="LengXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(943897-306696)
        </div>
      </div>



      <el-dialog v-model="chartDialogVisible6" title="煤日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick6"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
            <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">煤</label>
        <div class="input-controls">
           <button @click="showChart6" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile6" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput6"
                  @change="onFileChange6"
                  entityType="GongYeXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(175297-438096)
        </div>
      </div>


      <el-dialog v-model="chartDialogVisible7" title="天然气(工业)日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick7"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">天然气(工业)</label>
        <div class="input-controls">
           <button @click="showChart7" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile7" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput7"
                  @change="onFileChange7"
                  entityType="GongYeXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(438097-700896)
        </div>
      </div>


      <el-dialog v-model="chartDialogVisible8" title="生物质能日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick8"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">生物质能</label>
        <div class="input-controls">
           <button @click="showChart8" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile8" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput8"
                  @change="onFileChange8"
                  entityType="GongYeXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(700897-963696)
        </div>
      </div>

    <el-dialog v-model="chartDialogVisible9" title="氢气日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick9"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">氢气</label>
        <div class="input-controls">
           <button @click="showChart9" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile9" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput9"
                  @change="onFileChange9"
                  entityType="GongYeXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(963697-1226496)
        </div>
      </div>


      <el-dialog v-model="chartDialogVisible10" title="天然气(交通)日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick10"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">天然气(交通)</label>
        <div class="input-controls">
          <button @click="showChart10" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile10" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput10"
                  @change="onFileChange10"
                  entityType="JiaoTongXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(131497-394296)
        </div>
      </div>


      <el-dialog v-model="chartDialogVisible11" title="电力(无V2G)日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick11"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">电力(无V2G)</label>
        <div class="input-controls">

           <button @click="showChart11" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile11" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput11"
                  @change="onFileChange11"
                  entityType="JiaoTongXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(394397-657096)
        </div>
      </div>


       <el-dialog v-model="chartDialogVisible12" title="电力(V2G)日平均值" width="80%">
     <div class="year-input-container">
       <el-form :model="yearForm" label-width="80px" class="input-form">
          <el-form-item label="年份数">
            <div class="input-group">
              <el-input-number
                v-model="yearForm.years"
                :min="6"
                :max="30"
                :precision="0"
                @change="handleYearChange"
                @blur="validateYear"
                :disabled="chartLoading"
                class="year-input"
              >
              </el-input-number>
              <el-button
                @click="handleViewClick12"
                type="primary"
                class="view-button"
                :loading="chartLoading"
              >
                查看
              </el-button>
            </div>
            <el-form-item v-if="yearError" :error-message="yearError" class="error-message"></el-form-item>
          </el-form-item>
        </el-form>
      </div>
      <div style="overflow-x: auto;">
        <div ref="chartContainer" class="chart-scroll-area"></div>
      </div>
    </el-dialog>
      <div class="input-group">
        <label class="input-label">电力(V2G)</label>
        <div class="input-controls">
           <button @click="showChart12" class="distribution-btn">
            <span class="btn-text">可视化</span>
          </button>
            <button @click="selectFile12" class="distribution-btn">
                <span class="btn-text"  >加载数据</span>
                <input
                  type="file"
                  ref="fileInput12"
                  @change="onFileChange12"
                  entityType="JiaoTongXQ"
                  style="display: none;"
                />
                <span class="file-name">solar_spring.txt</span>
            </button>(657097-919896)
        </div>
      </div>
    </div>
</div>
</template>


<script lang="ts" setup>
import { reactive, ref, nextTick } from 'vue'
import axios from 'axios'
import {  ElMessage ,ElButton,ElMessageBox  } from 'element-plus'
import * as echarts from 'echarts'
const num = ref(1)

const selectFile1 = () => {
  fileInput1.value!.click()
}

const onFileChange1 = async () => {
const file = fileInput1.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput1.value) {
        fileInput1.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)
  const startId = 131497;
  let url = `http://localhost:8080/dianxq/upload/8760/${startId}/${num.value}`;
  try{
  const res = await axios.post(url,formData,{
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
  ElMessageBox.alert(res.data.message || '上传成功', '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput.value!.value = ''
      }
    })
  } catch (err: any) {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput.value!.value = ''
      }
    })
}
}
const selectFile2 = () => {
  fileInput2.value!.click()
}

const onFileChange2 = () => {
const file = fileInput2.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput2.value) {
        fileInput2.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput2.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput2.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput2.value!.value = ''
      }
    })
  })
}


const selectFile3 = () => {
  fileInput3.value!.click()
}

const onFileChange3 = () => {
const file = fileInput3.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput3.value) {
        fileInput3.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput3.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput3.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput3.value!.value = ''
      }
    })
  })
}

const selectFile4 = () => {
  fileInput4.value!.click()
}

const onFileChange4 = () => {
const file = fileInput4.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput4.value) {
        fileInput4.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput4.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput4.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput4.value!.value = ''
      }
    })
  })
}

const selectFile5 = () => {
  fileInput5.value!.click()
}

const onFileChange5 = () => {
const file = fileInput5.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput5.value) {
        fileInput5.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput5.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput5.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput5.value!.value = ''
      }
    })
  })
}

const selectFile6 = () => {
  fileInput6.value!.click()
}

const onFileChange6 = () => {
const file = fileInput6.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput6.value) {
        fileInput6.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput6.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput6.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput6.value!.value = ''
      }
    })
  })
}

const selectFile7 = () => {
  fileInput7.value!.click()
}

const onFileChange7 = () => {
const file = fileInput7.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput7.value) {
        fileInput7.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput7.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput7.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput7.value!.value = ''
      }
    })
  })
}

const selectFile8 = () => {
  fileInput8.value!.click()
}

const onFileChange8 = () => {
const file = fileInput8.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput8.value) {
        fileInput8.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput8.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput8.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput8.value!.value = ''
      }
    })
  })
}

const selectFile9 = () => {
  fileInput9.value!.click()
}

const onFileChange9 = () => {
const file = fileInput9.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput9.value) {
        fileInput9.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput9.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput9.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput9.value!.value = ''
      }
    })
  })
}

const selectFile10 = () => {
  fileInput10.value!.click()
}

const onFileChange10 = () => {
const file = fileInput10.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput10.value) {
        fileInput10.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput10.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput10.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput10.value!.value = ''
      }
    })
  })
}


const selectFile11 = () => {
  fileInput11.value!.click()
}

const onFileChange11 = () => {
const file = fileInput11.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput11.value) {
        fileInput11.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput11.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput11.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput11.value!.value = ''
      }
    })
  })
}

const selectFile12 = () => {
  fileInput12.value!.click()
}

const onFileChange12 = () => {
const file = fileInput12.value?.files?.[0];
if (!file) return;

if (!file.name.endsWith('.csv')) {
  ElMessageBox.alert('请选取 csv 文件！', '错误', {
    confirmButtonText: '确定',
    type: 'error',
    closeOnClickModal: false,
    callback: () => {
      if (fileInput12.value) {
        fileInput12.value.value = '';
      }
    }
  });
  return;
}

  const formData = new FormData()
  formData.append('file', file)

  axios.post('http://localhost:8080/import/csv/' + fileInput12.value!.getAttribute('entityType'), formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(res => {
    ElMessageBox.alert(res.data.data, '成功', {
      confirmButtonText: '确定',
      type: 'success',
      closeOnClickModal: false,
      callback: () => {
        fileInput12.value!.value = ''
      }
    })
  }).catch(err => {
    const message = err.response?.data?.message || '上传失败'
    ElMessageBox.alert(message, '错误', {
      confirmButtonText: '确定',
      type: 'error',
      closeOnClickModal: false,
      callback: () => {
        fileInput12.value!.value = ''
      }
    })
  })
}

const fileInput1 =  ref<HTMLInputElement | null>(null)
const fileInput2 =  ref<HTMLInputElement | null>(null)
const fileInput3 =  ref<HTMLInputElement | null>(null)
const fileInput4 =  ref<HTMLInputElement | null>(null)
const fileInput5 =  ref<HTMLInputElement | null>(null)
const fileInput6 =  ref<HTMLInputElement | null>(null)
const fileInput7 =  ref<HTMLInputElement | null>(null)
const fileInput8 =  ref<HTMLInputElement | null>(null)
const fileInput9 =  ref<HTMLInputElement | null>(null)
const fileInput10 =  ref<HTMLInputElement | null>(null)
const fileInput11 =  ref<HTMLInputElement | null>(null)
const fileInput12 =  ref<HTMLInputElement | null>(null)
// 定义后端返回的每日平均值数据类型
interface DailyAverageVO {
  dayOfYear: number;
  averageValue: number;
}



const chartDialogVisible1 = ref(false)
const chartDialogVisible2 = ref(false)
const chartDialogVisible3 = ref(false)
const chartDialogVisible4 = ref(false)
const chartDialogVisible5 = ref(false)
const chartDialogVisible6 = ref(false)
const chartDialogVisible7 = ref(false)
const chartDialogVisible8 = ref(false)
const chartDialogVisible9 = ref(false)
const chartDialogVisible10 = ref(false)
const chartDialogVisible11 = ref(false)
const chartDialogVisible12 = ref(false)

let chartInstance: echarts.ECharts | null = null


const chartContainer = ref<HTMLElement | null>(null)
const chartLoading = ref(true);

const yearForm = reactive({
  years: 1
})
const yearError = ref('')
// 点击查看按钮
const handleViewClick1 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart1()
}
const handleViewClick2 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart2()
}
const handleViewClick3 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart3()
}
const handleViewClick4 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart4()
}
const handleViewClick5 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart5()
}
const handleViewClick6 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart6()
}
const handleViewClick7 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart7()
}
const handleViewClick8 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart8()
}
const handleViewClick9 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart9()
}
const handleViewClick10 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart10()
}
const handleViewClick11 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart11()
}
const handleViewClick12 = async () => {
  if (!validateYear()) {
    return
  }
  await showChart12()
}

// 点击可视化按钮
const showChart1 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/dianxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible1.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart1(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart2 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/dianxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible2.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart2(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}


const showChart3 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/dianxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible3.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart3(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}


const showChart4 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/rexq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible4.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart4(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart5 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/lengxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible5.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart5(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart6 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/gongyexq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible6.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart6(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart7 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/gongyexq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible7.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart7(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart8 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/gongyexq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible8.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart8(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart9 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/gongyexq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible9.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart9(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart10 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/jiaotongxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible10.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart10(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart11 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/jiaotongxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible11.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart11(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

const showChart12 = async () => {
  try {
     // 校验年份输入
    if (!validateYear()) {
      return
    }
    // 调用后端接口获取每日平均值，并指定响应数据类型
    const years = encodeURIComponent(yearForm.years);
    const url = 'http://localhost:8080/jiaotongxq/daily-average?years=' + years;
    const response = await axios.get<{ data: DailyAverageVO[] }>(url)
    console.log('原始响应:', response.data)
    // const dailyData: DailyAverageVO[] = response.data.data
     const dailyData: DailyAverageVO[] = Array.isArray(response.data) ? response.data : [];

    if (dailyData.length === 0) {
      ElMessage.error('没有获取到数据')
        chartLoading.value = false
      return
    }

    // 准备图表数据，显式指定item类型
    const days = dailyData.map((item: DailyAverageVO) => item.dayOfYear)
    const averages = dailyData.map((item: DailyAverageVO) => item.averageValue)

    chartDialogVisible12.value = true
   // 确保 DOM 渲染后初始化图表
    nextTick(() => {
      initChart12(days, averages)
    })
    chartLoading.value = false

    // 显示图表弹窗

  } catch (error) {
    console.error('获取图表数据失败:', error)
    ElMessage.error('获取图表数据失败')
      chartLoading.value = false
  }
}

// 年份输入校验
const validateYear = () => {
  if (!yearForm.years) {
    yearError.value = '请输入年份数'
    return false
  }

  if (yearForm.years < 1 || yearForm.years > 30) {
    yearError.value = '年份数必须在1到30之间'
    return false
  }

  yearError.value = ''
  return true
}

const handleYearChange = () => {
  yearError.value = ''
}

// 初始化图表，添加参数类型
const initChart1 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '电力需求日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart2 = (days: number[], averages: number[]) => {
 if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '电转生物质能需求日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart3 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '用于交通的电能需求日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart4 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '热需求日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart5 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '冷需求日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart6 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '煤日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart7 = (days: number[], averages: number[]) => {
 if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '天然气(工业)日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart8 = (days: number[], averages: number[]) => {
 if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '生物质能日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart9 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '氢气日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart10 = (days: number[], averages: number[]) => {
 if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '天然气(交通)日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart11 = (days: number[], averages: number[]) => {
 if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '电力(无V2G)日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};

const initChart12 = (days: number[], averages: number[]) => {
  if (!chartContainer.value) return;

  // 设置宽度根据数据量动态扩展
  const containerWidth = Math.max(1600, days.length * 3);
  chartContainer.value.style.width = `${containerWidth}px`;
  chartContainer.value.style.height = '400px';

  if (chartInstance) chartInstance.dispose();
  chartInstance = echarts.init(chartContainer.value);

  const option = {
    title: {
      text: '电力(V2G)日平均值折线图',
      left: 'center',
      top: '10px'
    },
    grid: {
      left: '5%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'cross' }
    },
    xAxis: {
      type: 'category',
      data: days,
      axisTick: { alignWithLabel: true },
      axisLabel: {
        interval: (index: number) => index % 100 == 0,  // 每100个显示一次
        rotate: 45
      }
    },
    yAxis: {
      type: 'value',
      name: '平均值 ',
      min: Math.floor(Math.min(...averages) * 0.9),
      max: Math.ceil(Math.max(...averages) * 1.1)
    },
    series: [{
      data: averages,
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 4,
      itemStyle: { color: '#7c3aed' },
      lineStyle: { width: 2 }
    }]
  };

  chartInstance.setOption(option);
  chartInstance.resize();

  window.addEventListener('resize', () => {
    chartInstance?.resize();
  });
};




// 弹出框状态
const dialogVisible = ref(false);

// 文件内容
const fileContent = ref('');

// 文件输入框引用
const fileInput = ref<HTMLInputElement | null>(null);

// 触发文件选择


// 处理文件选择
const handleFileChange = async (event: Event) => {
  const target = event.target as HTMLInputElement;
  if (!target.files || target.files.length === 0) return;

  const file = target.files[0];
  try {
    // 读取文件内容
    const content = await readFile(file);
    fileContent.value = content;
    dialogVisible.value = true; // 显示弹出框
  } catch (error) {
    console.error('读取文件失败:', error);
  }
};

// 文件读取函数
const readFile = (file: File): Promise<string> => {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = (e) => resolve(e.target?.result as string);
    reader.onerror = reject;
    reader.readAsText(file); // 支持文本文件
  });
};

</script>

<style scoped>
.center-input {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}
.chart-scroll-area {
  min-width: 1600px;
  height: 400px;
}
.year-input-container {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
}
.error-message {
  margin-top: 5px;
  font-size: 12px;
  color: #f56c6c;
  width: 100%;
}
.input-form {
  display: flex;
  align-items: center;
  width: 100%;
}
.year-input {
  flex: 1;
  width: auto;
}
.view-button {
  min-width: 80px;
  height: 38px;
}
.input-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.electricity-container {
  background-color: #f8fafc;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 36px;
  max-width: 920px;
  margin: 0 auto;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: #1e293b;
}

.title {
  color: #4c1d95;
  text-align: center;
  margin-bottom: 32px;
  font-size: 28px;
  font-weight: 700;
  padding-bottom: 16px;
  border-bottom: 2px solid #7c3aed;
  letter-spacing: 0.5px;
}

.section-title {
  color: #475569;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.form-section, .info-section, .price-section {
  background-color: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.input-group {
  display: flex;
  margin-bottom: 18px;
  gap: 16px;
}

.input-label {
  min-width: 180px;
  font-weight: 500;
  color: #475569;
  padding-top: 10px;
  margin-right: 8px; /* 与输入框保持一定间距 */
  font-size: 14px;
}

.input-controls {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.input-wrapper {
  display: flex;
  align-items: center;
  /* background-color: #f8fafc; */
  border-radius: 8px;
  padding: 2px;
  border: 1px solid #f8fafc;
}

.form-input {
  padding: 10px 16px;
  border: 1px solid #053676;
  border-radius: 6px;
  width: 80px;
  text-align: right;
  font-size: 15px;
  background: transparent;
  color: #1e293b;
}

.form-input.small {
  width: 100px;

}

.form-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.unit {
  margin: 0 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 500;
}

.distribution-btn {
  background-color: #7c3aed;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.distribution-btn:hover {
  background-color: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn-text {
  font-size: 14px;
  line-height: 1.2;
}

.file-name {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-style: italic;
  margin-top: 2px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.info-card {
  background-color: #f8fafc;
  padding: 18px;
  border-radius: 10px;
  border-left: 4px solid #7c3aed;
  transition: transform 0.2s, box-shadow 0.2s;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.info-label {
  display: block;
  font-weight: 500;
  color: #475569;
  margin-bottom: 10px;
  font-size: 15px;
}

.info-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-value {
  font-weight: 600;
  color: #4c1d95;
  font-size: 15px;
  white-space: nowrap;
}

.price-input-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.price-label {
  font-weight: 500;
  color: #475569;
  min-width: 180px;
}

.price-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 768px) {
  .electricity-container {
    padding: 24px;
    border-radius: 0;
  }

  .input-group {
    flex-direction: column;
    gap: 8px;
  }

  .input-label {
    min-width: auto;
    padding-top: 0;
    margin-bottom: 6px;
  }

  .input-controls {
    width: 100%;
  }

  .form-input {
    width: 100%;

  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .price-input-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
</style>
